package view;

import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JToggleButton;
import util.Images;
import util.PaintUtilities;

/**
 * A note button is a button which indicates whether a note is places at its location.
 * @author Hedja
 */
public class NoteButton extends JToggleButton {

	public NoteButton() {
		this.setContentAreaFilled(false);
		this.setFocusPainted(false);
		this.setOpaque(false);
	}

	@Override
	public void paintComponent(Graphics g) {
		Graphics2D g2 = (Graphics2D)g;
		PaintUtilities.setUpGraphics(g2);
		//Draw the marker image only if its selected.
		if(this.isSelected()) {
			g2.drawImage(
				Images.getMarker(false),0,0,this.getWidth()-1,this.getHeight()-1, null
			);
		}
	}

}
